<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=VgjSoFZAOzuMgU2mpu8MfGtnn1AwEvKO"></script>
	<title>驾车导航的结果面板</title>
	<link rel="stylesheet" type="text/css" href="/static/frontend/css/style.css" />
    <link rel="stylesheet" type="text/css" href="/static/frontend/css/global.css" /> 
    <link href="/static/frontend/css/css.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/static/frontend/css/nrzzsc.css" type="text/css" />
   
    <style type="text/css">
		body, html {width: 100%;height: 100%; margin:0;font-family:"微软雅黑";}
		#l-map{height:300px;width:100%;}
		#r-result,#r-result table{width:100%;}
	</style>
    <script type="text/javascript" src="/static/frontend/jquery-1.7.2.min.js"></script>
</head>
<body>
	 <div class="header1">
     {include file="../application/frontend/view/common/top.html" /}
     </div>
     <div class="nav">
    {include file="../application/frontend/view/common/nav.html"}
    </div>
    <div style="width:730px;margin:0 auto;">   
        起点：<input id="text_" type="text" value=""/>
        <input type="button" value="查询" onclick="searchByName();"/>

    </div>
	<div id="l-map"></div>
	<div id="r-result"></div>
    <div class="footer" style="background-color:white;">
    {include file="../application/frontend/view/common/bottom.html"}
    </div>
	
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("l-map");
	  map.centerAndZoom(new BMap.Point(113.544001,22.104104),15);
	  var marker = new BMap.Marker(new BMap.Point(113.544001,22.104104));  //创建标注，为要查询的地址对应的经纬度 
      map.addOverlay(marker)

	  function searchByName()
	  {
	  	 var keyword = document.getElementById("text_").value;
	  	 var driving = new BMap.DrivingRoute(map, {renderOptions: {map: map, panel: "r-result", autoViewport: true}});
	  	
	     driving.search('"'+keyword+'"', "珠海长隆海洋公园");

	  }

	
       
	var geolocation = new BMap.Geolocation();
	var geoc = new BMap.Geocoder();    
    geolocation.getCurrentPosition(function(r){
        if(this.getStatus() == BMAP_STATUS_SUCCESS){
            //var mk = new BMap.Marker(r.point);//创建地址标志物
            // map.addOverlay(mk);//地图上添加标志物
            // map.panTo(r.point);//地图中心移动
            //alert('您的位置：'+r.point.lng+','+r.point.lat);
            var point=new BMap.Point(r.point.lng,r.point.lat);
            geoc.getLocation(point,function(re){

             document.getElementById("text_").value=re.address;

            });

        }
        else {
            alert('failed'+this.getStatus());
        }
    },{enableHighAccuracy: true})

      
</script>
